package com.amit.Basic_Simple_Program;

import java.util.Scanner;

public class Deletion_Element_Array {
	
	public static void main(String[] args)
	{

	 int a[],position;
	 System.out.println("Enter the element number for array's element");
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 
	 a=new int[n];
	 System.out.println("Enter the element of array");
	 
	 for(int i=0;i<=a.length-1;i++)
	 {
		 a[i]=sc.nextInt();
	 }
	 
	 System.out.println("Enter the postion for deleting the element");
	 position=sc.nextInt();
	 
	 if(position>=n+1)
	 {
		 System.out.println("Deletion is not possible");
	 }
	 else
	 {
		 for(int c=position-1;c<n-1;c++)
		 {
			 a[c]=a[c+1];
		 }
		 
		 System.out.println("Resultant array");
		 
		 for(int j=0;j<a.length-1;j++)
		 {
			 System.out.println(a[j]);
		 }
	 }
		
	}

}
